<div>
  <el-breadcrumb separator-class="el-icon-arrow-right" class="bread">
    <el-breadcrumb-item :to="{ path: '/login' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item>权限管理</el-breadcrumb-item>
    <el-breadcrumb-item>权限列表</el-breadcrumb-item>
  </el-breadcrumb>
  <el-table :data="rolesData" style="width: 100%">
    <el-table-column type="expand">
      <template slot-scope="scope">
        <!-- 遍历行 -->
        <el-row
          v-for="item1 in scope.row.children"
          :key="item1.id"
          class="row1"
          :id="rolesId"
        >
          <el-col :span="4">
            <div class="grid-content bg-purple">
              <el-tag closable class="tag">
                {{ item1.authName }}
              </el-tag>
            </div>
          </el-col>
          <el-col :span="20">
            <div class="grid-content bg-purple-light">
              <el-row v-for="item2 in item1.children" :key="item2.id">
                <el-col :span="4">
                  <div class="grid-content bg-purple">
                    <el-tag closable type="success" class="col">
                      {{ item2.authName }}
                    </el-tag>
                  </div>
                </el-col>
                <el-col :span="20">
                  <div class="grid-content bg-purple-light">
                    <!-- 这里只要遍历标签就可以了 -->
                    <el-tag
                      v-for="item3 in item2.children"
                      :key="item3.id"
                      closable
                      type="warning"
                      class="tag"
                    >
                      {{ item3.authName }}
                    </el-tag>
                  </div>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
      </template>
    </el-table-column>
    <el-table-column type="index" width="50"> </el-table-column>
    <el-table-column label="角色名称" prop="roleName"> </el-table-column>
    <el-table-column label="描述" prop="roleDesc"> </el-table-column>
    <el-table-column label="操作">
      <template slot-scope="scope">
        <el-button
          type="primary"
          plain
          size="mini"
          icon="el-icon-edit"
        ></el-button>
        <el-button
          type="danger"
          plain
          size="mini"
          icon="el-icon-delete"
        ></el-button>
        <el-button
          type="success"
          plain
          size="mini"
          icon="el-icon-check"
          @click="showRolesDialog(scope.row)"
          >分配权限</el-button
        >
      </template>
    </el-table-column>
  </el-table>
  <!-- dialog -->
  <el-dialog title="角色授权" :visible.sync="dialogRolesVisible" class="dialog">
    <el-tree
      :data="rolesTreeData"
      show-checkbox
      node-key="id"
      :default-expand-all="true"
      :props="defaultProps"
      ref="tree"
    >
    </el-tree>
    <div slot="footer" class="dialog-footer">
      <el-button @click="hideRolesDialog">取 消</el-button>
      <el-button type="primary" @click="assignRights"
        >确 定</el-button
      >
    </div>
  </el-dialog>
</div>
